package Items;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.helloandroid.R;



 public class ItemListBaseAdapterComentarios extends BaseAdapter {
	 private static ArrayList<ElementoComentario> itemDetailsrrayList;
	  
	  
	 private LayoutInflater l_Inflater;
	 
	 public ItemListBaseAdapterComentarios(Context context, ArrayList<ElementoComentario> results) {
	  itemDetailsrrayList = results;
	  l_Inflater = LayoutInflater.from(context);
	 }
	 
	 public int getCount() {
	  return itemDetailsrrayList.size();
	 }
	 
	 public Object getItem(int position) {
	  return itemDetailsrrayList.get(position);
	 }
	 
	 public long getItemId(int position) {
	  return position;
	 }
	 
	 public View getView(int position, View convertView, ViewGroup parent) {
	  ViewHolder holder;
	  if (convertView == null) {
	   convertView = l_Inflater.inflate(R.layout.item_list_comentario, null);
	   holder = new ViewHolder();
	   holder.txt_itemName = (TextView) convertView.findViewById(R.id.nombrecomentario);
	   holder.txt_comentario = (TextView) convertView.findViewById(R.id.comentariolista);

	 
	   convertView.setTag(holder);
	  } else {
	   holder = (ViewHolder) convertView.getTag();
	  }
	   
	  holder.txt_itemName.setText(itemDetailsrrayList.get(position).getNombre());
	  holder.txt_comentario.setText(itemDetailsrrayList.get(position).getComentario());

	 
	  return convertView;
	 }
	
	 
	 static class ViewHolder {
	  TextView txt_itemName;
	  TextView txt_comentario;

	 }
	}
